--蟲害防治
local chonghaifangzhi = fk.CreateSkill {
    name = "mcdh_chonghaifangzhi",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

chonghaifangzhi:addEffect(fk.TurnStart,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and target ~= player and #target:getCardIds("j") ~= 0
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local re =  room:askForCard(player, 1, 1, true, self.name, true, ".", "#chonghaifangzhi:"..target.id )
        room:recastCard(re, player, self.name)
        if #re > 0 then
            return true
        end
    end,
    on_use  = function(self, event, target, player, data)
        local room = player.room
        local card =  room:askForCard(player, 1, 1, true, self.name, false, ".", "#chonghaifangzhi-give:"..target.id )
        room:moveCardTo(card, Card.PlayerHand, target, fk.ReasonGive, self.name, nil, false, player.id)
    end
})

Fk:loadTranslationTable {
    ["mcdh_chonghaifangzhi"] = "蟲害防治",
    [":mcdh_chonghaifangzhi"] = "『蟲害防治』<br>其他角色的回合开始时，若其判定区内有牌，你可以重铸一张牌，然后交给其一张牌。",
    ["#chonghaifangzhi"] = "蟲害防治：重铸一张牌，然后交给 %src 一张牌。",
    ["#chonghaifangzhi-give"] = "蟲害防治：交给 %src 一张牌。"
}

return chonghaifangzhi